#ifndef __WIZ_GEOMETRY_BOX_AXIS_ALIGNED_HPP__SHANHAOBO_19800429__
#define __WIZ_GEOMETRY_BOX_AXIS_ALIGNED_HPP__SHANHAOBO_19800429__

#include "./WizGeometryBox.hpp"

namespace Wiz
{
    namespace AABox
    {
        template<class ElementT>
        struct Type : public ::Wiz::Box::Type<ElementT>
        {
            WIZ_DECLARE_CLASS_THIS(Type);

            typedef ::Wiz::Box::Type<tElement>      tSuper;

        public:
            Type() : tSuper()
            {
            }

            Type(tVector3In InCenter, tVector3In InExtents) : tSuper()
            {
                SetAABox(InCenter, InExtents);
            }

            Type(tVector3In InCenter, tElementIn InX, tElementIn InY, tElementIn InZ)
                : tSuper()
            {
                SetAABox(InCenter, tVector3(InX, InY, InZ));
            }

        public:
            ::Wiz::Void::Type SetAABox(tVector3In InCenter, tVector3In InExtents)
            {
                if ((InExtents.x > 0) && (InExtents.y > 0) && (InExtents.z > 0))
                {
                    Set(InCenter - InExtents, InCenter + InExtents);
                }
            }
            ::Wiz::Void::Type SetAABox(tVector3In InCenter, tElementIn InX, tElementIn InY, tElementIn InZ)
            {
                SetAABox(InCenter, tVector3(InX, InY, InZ));
            }
        public:
            ::Wiz::Bool::Type GetCenter(tVector3Out OutCenter) const
            {
                if (m_IsValid)
                {
                    OutCenter = (m_Min + m_Max) * 0.5;
                    return ::Wiz::Bool::True;
                }
                return ::Wiz::Bool::False;
            }
            ::Wiz::Bool::Type GetExtents(tVector3Out OutExtents) const
            {
                if (m_IsValid)
                {
                    OutExtents = (m_Max - m_Min) * 0.5;
                    return ::Wiz::Bool::True;
                }
                return ::Wiz::Bool::False;
            }

            ::Wiz::Bool::Type GetCenterAndExtents(tVector3Out OutCenter, tVector3Out OutExtents) const
            {
                if (GetExtents(OutExtents))
                {
                    OutCenter = OutExtents + m_Min;
                    return ::Wiz::Bool::True;
                }
                return ::Wiz::Bool::False;
            }
        };
    } /// end of namespace AABox
} /// end of namespace Wiz

#endif /*__WIZ_GEOMETRY_BOX_AXIS_ALIGNED_HPP__SHANHAOBO_19800429__*/
